package com.ruoyi.web.controller.system;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.domain.SysRegion;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.service.ISysRegionService;

/**
 * 区划管理Controller
 *
 * @author ruoyi
 * @date 2023-07-04
 */
@RestController
@RequestMapping("/system/region")
public class SysRegionController extends BaseController {
    @Autowired
    private ISysRegionService sysRegionService;

    /**
     * 获取子区划列表
     */
    @PreAuthorize("@ss.hasPermi('system:region:list')")
    @GetMapping("/children/{pbh}")
    public AjaxResult children(@PathVariable("pbh") String pbh) {
        return success(sysRegionService.children(pbh));
    }

    /**
     * 获取区划管理详细信息
     */
    @PreAuthorize("@ss.hasPermi('biz:region:query')")
    @GetMapping(value = "/{bh}")
    public AjaxResult getInfo(@PathVariable("bh") String bh) {
        return success(sysRegionService.selectSysRegionByBh(bh));
    }


}
